package models

import (
	"github.com/astaxie/beego/orm"
)

/*
** 适应症
 */
type Indication struct {
	Id           int64
	IndicationId string `orm:"size(10);index"`
	MolId        string `orm:"size(10);index"`
	Mesh         string `orm:"size(256)"`
	MeshId       string `orm:"size(10);index"`
	EfoId        string `orm:"size(20);index"`
	EfoTerm      string `orm:"size(256)"`
	MaxPhase     int64
}

func (m *Indication) TableName() string {
	return "indication"
}

func (m *Indication) Insert() error {
	if _, err := orm.NewOrm().Insert(m); err != nil {
		return err
	}
	return nil
}

func (m *Indication) Read(fields ...string) error {
	if err := orm.NewOrm().Read(m, fields...); err != nil {
		return err
	}
	return nil
}

func (m *Indication) Update(fields ...string) error {
	if _, err := orm.NewOrm().Update(m, fields...); err != nil {
		return err
	}
	return nil
}

func (m *Indication) Delete() error {
	if _, err := orm.NewOrm().Delete(m); err != nil {
		return err
	}
	return nil
}

func (m *Indication) Query() orm.QuerySeter {
	return orm.NewOrm().QueryTable(m)
}
